<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html>

<ui:composition template="../template.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <ui:define name="content">
        <div class="col-md-4">
            <div>
                <h:form>
                    <h:commandButton value="Regresar" class="btn btn-default" action="#{persona.iniciar()}"/>                                 
                </h:form>
            </div>
            <br/>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">Mantenimiento Persona</h3>
                </div>
                <div class="panel-body">
                    <h:form class="form-horizontal" >
                        <h:inputHidden value="#{persona.codigo}" />
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="nombre">Nombre</label>
                            <div class="col-sm-10">
                                <h:inputText  class="form-control input-sm" id="nombre" value="#{persona.nombre}" required="true" requiredMessage="*"/>
                                <h:message for="nombre" style="color:red;"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="apellido" class="col-sm-2 control-label">Apellido</label>
                            <div class="col-sm-10">
                                <h:inputText  class="form-control input-sm" id="apellido" value="#{persona.apellido}" required="true" requiredMessage="*"/>
                                 <h:message for="apellido" style="color:red;"/>
                            </div>
                        </div>
                        <h:commandButton class="btn btn-primary btn-sm" action="#{persona.grabar}" value="Grabar" />
                    </h:form>                
                </div>
            </div>
            <h:panelGroup rendered="#{persona.mensajeExito!=null}" id="panelMensaje" >
                <div style="text-align: center;">
                    <span class="alert alert-success">
                        <h:outputText value="#{persona.mensajeExito}" escape="false"/>
                    </span>
                </div>
            </h:panelGroup>
        </div> 
    </ui:define>
</ui:composition>
